package edu.sctu.nieyu.day20150614.IOUtil;

import java.io.*;

/**
 * Created by user01 on 2015/6/14.
 */
public class ReaderUtil {

    FileWriter fileWriter;
    FileReader fileReader;

    public void fileReader() {

        int count = 0;
        int countbyte = 0;
        File file = new File("D://1456.txt");
        char[] chars = new char[1024];
        try {
            fileReader = new FileReader(file);
            fileWriter = new FileWriter("D://14561.txt");
            try {
                while ((count = fileReader.read(chars)) != -1) {
                    fileWriter.write(chars,0,count);
                    countbyte+= count;
                        System.out.println(countbyte);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            fileReader.close();
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
